[ToC] [Up] [Back] [Next] ... [Book Plug] The Information Commons
.................... Introduction to HTML

4. BODY

The BODY element contains all the content of a document, as opposed to the HEAD, which contains information about the document. Various mark-up elements are allowed within the body to indicate headings, paragraphs, lists, hypertext links, images, and so on. These are described and illustrated in documents following this one.

The following shows typical use of HEAD and BODY elements, using this document as an example:


<HTML>
<HEAD>
<TITLE> BODY element in HTML </TITLE>
<BASE HREF="http://www.utoronto.ca/webdocs/HTMLdocs/NewHTML/body.html">
</HEAD>

<BODY>
[<a href="htmlindex.html">ToC</a>]
[<a href="htmlindex.html">Up</a>]

<H1> BODY Element in HTML </H1>

<p> The BODY element contains all the content of the document,
as opposed to the <a href="head.html">HEAD</a>, which 
contains information about the document.  ......
</BODY>
</HTML>

4.0.1 The BACKGROUND Attribute

In HTML 2.0 the BODY element takes no attributes. In HTML 3 The BODY element can take the single attribute BACKGROUND. This allows you to specify an image file to be used as a background (a bit like a watermark) to the indicated BODY. This attribute is only functional on certain browsers, such as Arena, and Netscape 1.1 or the Microsoft Internet Explorer. browsers. The following example:
 <BODY BACKGROUND="back/marble.gif">
 <h1> Bla Bla Bla </h1>
 <p> And still more text....
 </BODY>
tiles the window background with the designated GIF image. Just click on the anchor to look at the example.

4.0.2 Netscape-Specific Extensions

Setting a background color is not enough -- for example, if you set the background to black, you need then to be able to alter the color of the text as well. Netscape has introduced several new attributes for controlling the text color. These are described below, and are likely to become part of the HTML standard. There is also an example document illustrating these BODY attributes.
BGCOLOR="#rrggbb"
Sets the background color to the specified RGB color value, where RR GG and BB are the hexadecimal color codes for the Red, Green and Blue levels, ranging from 0 to 255 -- that is, 00 to FF. The color "000000" is black, while "FFFFFF" is white. If there is also a background image, the BGCOLOR is used as the color underneath the background image -- if the background image is transparent, this is the color that shows through.
TEXT="#rrggbb"
Sets the default text color to the specified RGB color value.
LINK="#rrggbb"
Sets the default text color of hypertext anchors to the specified RGB color value.
VLINK="#rrggbb"
Sets the default text color of visited hypertext links to the specified RGB color value.

[ToC] [Up] [Back] [Next] ... [Book Plug] .................... Introduction to HTML

© Ian Graham 1994-1995 Page Last Updated: 4 December 1995